package com.aishua.aishuawallet.fregment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.aishua.aishuawallet.Constant;
import com.aishua.aishuawallet.R;
import com.aishua.aishuawallet.activity.BaseActivity;
import com.aishua.aishuawallet.activity.LoginActivity;
import com.aishua.aishuawallet.diydialog.ExitLoginDialog;
import com.aishua.aishuawallet.utils.LogUtils;

import org.spongycastle.jcajce.provider.symmetric.Serpent;

/**
 * Created by aishua on 2018/7/31.
 */

public class BaseFragment extends Fragment {

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

         touristMode();
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    public void touristMode() {

        if (Constant.ISTOURIST){

            LogUtils.v("BaseFrament:onCreateView()");
            final ExitLoginDialog exitLoginDialog = ExitLoginDialog.newInstance(getContext().getResources().getString(R.string.lookfirstdialog));
            exitLoginDialog.show(getActivity().getFragmentManager(), "exit");
            exitLoginDialog.setCancelable(false);
            exitLoginDialog.setCancleButtonListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    exitLoginDialog.dismiss();

                }
            });
            exitLoginDialog.setSureButtonListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    Intent intent = new Intent(getContext(), LoginActivity.class);
                    startActivity(intent);
                    getActivity().finish();


                }
            });
        }
    }


}
